<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>API测试</title>
    <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
</head>
<body>
    <h1>API测试</h1>
    <div>
        <h2>培训记录API测试</h2>
        <button id="testTrainingBtn">测试培训记录API</button>
        <pre id="trainingResult" style="background-color: #f5f5f5; padding: 10px; margin-top: 10px;"></pre>
    </div>
    <div>
        <h2>绩效考核API测试</h2>
        <button id="testPerformanceBtn">测试绩效考核API</button>
        <pre id="performanceResult" style="background-color: #f5f5f5; padding: 10px; margin-top: 10px;"></pre>
    </div>

    <script>
        document.getElementById('testTrainingBtn').addEventListener('click', async () => {
            try {
                const response = await axios.get('http://localhost:8082/api/training/records', {
                    params: {
                        pageNum: 1,
                        pageSize: 10
                    }
                });
                document.getElementById('trainingResult').textContent = JSON.stringify(response.data, null, 2);
            } catch (error) {
                document.getElementById('trainingResult').textContent = '错误: ' + (error.response ? JSON.stringify(error.response.data, null, 2) : error.message);
            }
        });

        document.getElementById('testPerformanceBtn').addEventListener('click', async () => {
            try {
                const response = await axios.get('http://localhost:8082/api/performances', {
                    params: {
                        pageNum: 1,
                        pageSize: 10
                    }
                });
                document.getElementById('performanceResult').textContent = JSON.stringify(response.data, null, 2);
            } catch (error) {
                document.getElementById('performanceResult').textContent = '错误: ' + (error.response ? JSON.stringify(error.response.data, null, 2) : error.message);
            }
        });
    </script>
</body>
</html> 